package cn.lanqiao.springbootproject.controller;

import cn.lanqiao.springbootproject.entity.Emp;
import cn.lanqiao.springbootproject.mapper.EmpMapper;
import cn.lanqiao.springbootproject.utill.Result;
import cn.lanqiao.springbootproject.vo.QueryEmpVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    private EmpMapper empMapper;
    @GetMapping("/querylist")
    public Result queryList(){
        List list=empMapper.queryList();
        if (list!=null) {return Result.success(list);}
        else return Result.error(200,"查询失败");
    }
    @PostMapping("/querybyemp")
    public Result queryByEmp(@RequestBody QueryEmpVO queryEmpVO){
        List list=empMapper.queryByEmp(queryEmpVO);
        if (list!=null) {return Result.success(list);}
        else return Result.error(400,"查询失败");
    }
}
